﻿@{
    ViewData["Title"] = "Index";
    Layout = "~/Areas/Console/Views/Shared/_Layout.cshtml";
}
@section head{
    <script type="text/javascript">
        var renderTable;
        var userType = 0;
        layui.config({
            base: '../../layuiadmin/' //静态资源所在路径
        }).extend({
            treetable: 'treetable-lay/treetable',
            index: 'lib/index'
        }).use(['table', 'form', 'treetable', 'index', 'laydate'], function () {
            var $ = layui.$
                , form = layui.form
                , admin = layui.admin
                , table = layui.table
                , element = layui.element
                , laydate = layui.laydate;

            //日期范围
            laydate.render({
                elem: '#createDate'
                , range: true
            });


            // 渲染表格
            renderTable = table.render({
                elem: '#table-datalist'
                , url: '/Console/CashVerification/GetListJson'
                , toolbar: '#table-datalist-toolbar'
                , limit: 20
                , title: '出金审核列表'
                , cols: [[
                    { field: 'orderNumber', title: '订单号' }
                    , {
                        field: 'fullName', title: '姓名', templet: function (res) {
                            return res.fullName;
                        }
                    }
                    , {
                        field: 'CRMAccount', title: 'CRM账户', templet: function (res) {
                            return res.loginName;
                        }
                    }
                    , {
                        field: 'tradingAccountNo', title: '交易账号', templet: function (res) {
                            return res.tradingAccount;
                        }
                    }
                    , {
                        field: 'paymentMethod', title: '出金方式', width: 90, templet: function (res) {
                            switch (res.paymentMethod) {
                                case 1: return "<span lay-event='electronicAccount' />"; break;
                                case 2: return "<span lay-event='bankAccount' />"; break;
                                case 3: return "<span lay-event='cryptocurrency' />"; break;
                            }
                        }
                    }
                    /*  , { field: 'cashOutAccount', title: '出金账号', width: 90 }*/
                    , {
                        field: 'state', title: '状态', width: 80, templet: function (res) {
                            switch (res.state) {
                                case 0: return "<span class='layui-btn layui-btn-primary layui-btn-xs' lay-event='inReview' />"; break;
                                case 2: return "<span class='layui-btn layui-btn-xs' lay-event='pass' />"; break;
                                case 1: return "<span class='layui-btn layui-btn-danger layui-btn-xs' lay-event='refuse' />"; break;
                            }
                        }
                    }
                    , { field: 'paymentAmount', title: '出金金额', width: 90 }
                    , { field: 'commission', title: '手续费', width: 80 }
                    , { field: 'receivedAmount', title: '到账金额', width: 90 }
                    , { field: 'createDate', title: '提交时间', width: 170 }
                    , { field: 'currentReviewer', title: '当前审核人', width: 100 }
                    , { field: 'endTime', title: '完结时间', width: 170 }
                    , { field: 'operate', fixed: 'right', title: '操作', toolbar: '#table-datalist-bar', width: 100 }
                ]]
                , id: "tableReload"
                , page: { layout: ['prev', 'page', 'next', 'refresh'] }
                , done: function (res) {
                    if (res.count == 0) {
                        $(".layui-table-main").html('<div class="layui-none">' + top.lang.noData + '</div>');
                    }
                    layer.closeAll('loading');

                    /**多语言初始化 */
                    top.SetListPageLanguage(layui);
                    top.SetSelectLanguage(layui);
                    layui.form.render("select");
                }
            });


            //头工具栏事件
            table.on('toolbar(table-datalist)', function (obj) {
                var checkStatus = table.checkStatus(obj.config.id);
                var data = checkStatus.data;

            });

            //监听行工具事件
            table.on('tool(table-datalist)', function (obj) {
                var data = obj.data;
                if (obj.event === 'toExamine' || obj.event === 'view') {
                    parent.layui.index.openTabsPage("/Console/CashVerification/CashVerificationDetail?id=" + data.orderNumber, top.lang.detailsOfWithdrawalAudit);
                }

            });

            form.on('submit(search)', function (data) {
                //执行重载
                table.reload('tableReload', {
                    page: { curr: 1, layout: ['prev', 'page', 'next', 'refresh'] }
                    , where: {
                        account: $("#account").val(),
                        createDate: $("#createDate").val(),
                        login: $("#login").val(),
                        orderNo: $("#orderNo").val(),
                        Reviewer: $("#currentReviewer").val(),
                        Mothod: $("#type option:selected").val(),
                        state: $("#state option:selected").val()
                    }
                });
            });

            form.on('submit(resetting)', function (data) {
                $("#account").val("");
                $("#createDate").val("");
                $("#login").val("");
                $("#orderNo").val("");
                $("#currentReviewer").val("");
                $("#type").val(-1);
                $("#state").val(-1);
                form.render();
            });
            form.on('submit(refresh)', function (data) {
                location.reload();
            });

        });
    </script>
}
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card layui-form" lay-filter="component-form-element">
                <div class="layui-card-body layui-form-pane" style="padding: 15px;">
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label" lay-event="nameOrAccount">姓/名/账户ID</label>
                            <div class="layui-input-inline">
                                <input type="text" name="account" id="account" class="layui-input" placeholder="nameOrAccount">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label" lay-event="paymentMethod">出金方式</label>
                            <div class="layui-input-inline">
                                <select name="type" id="type">
                                    <option value="-1" lay-event="pleaseSelect">请选择</option>
                                    <option value="1" lay-event="electronicAccount">国际电汇</option>
                                    <option value="2" lay-event="bankAccount">银行汇款</option>
                                    <option value="3" lay-event="cryptocurrency">加密货币</option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label" lay-event="orderNumber">订单号</label>
                            <div class="layui-input-inline">
                                <input type="text" name="orderNo" id="orderNo" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label" lay-event="state">状态</label>
                            <div class="layui-input-inline">
                                <select name="state" id="state">
                                    <option value="-1" lay-event="pleaseSelect">请选择</option>
                                    @*<option value="0" lay-event="noExamine">未提交审核</option>*@
                                    <option value="0" lay-event="inReview">审核中</option>
                                    <option value="2" lay-event="pass">通过</option>
                                    <option value="1" lay-event="refuse">拒绝</option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label" lay-event="createDate">创建时间</label>
                            <div class="layui-input-inline">
                                <input type="text" class="layui-input" id="createDate" name="createDate" placeholder=" - " lay-key="8">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label" lay-event="currentReviewer">当前审核人</label>
                            <div class="layui-input-inline">
                                <input type="text" name="currentReviewer" id="currentReviewer" class="layui-input">
                            </div>
                        </div>
                        @*<div class="layui-inline">
                                <label class="layui-form-label" lay-event="cashOutAccount">出金账号</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="login" id="login" class="layui-input">
                                </div>
                            </div>*@
                    </div>
                    <div class="layui-form-item" style="text-align:center;">
                        <div class="layui-input-block">
                            <button class="layui-btn" lay-submit="" lay-filter="search" lay-event="search">搜索</button>
                            <button class="layui-btn layui-btn-warm" lay-submit="" lay-filter="resetting" lay-event="resetting">重置</button>
                            <button class="layui-btn layui-btn-primary" lay-submit="" lay-filter="refresh" lay-event="refresh">刷新</button>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-card">
                <div class="layui-card-body">
                    <div class="layui-tab-content">
                        <table class="layui-hide" id="table-datalist" lay-filter="table-datalist"></table>
                        <script type="text/html" id="table-datalist-bar">
                            {{#if(d.state==0){}}
                            <button class="layui-btn layui-btn-sm  layui-btn-normal" lay-event="toExamine">审核</button>
                            {{#}else{}}
                            <button class="layui-btn layui-btn-sm" lay-event="view">查看</button>
                            {{#}}}
                        </script>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

